<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
</head>
<body>
	<div id="root">
		<!-- 根据type属性来渲染不同组件 -->
		<component :is="type"></component>
		<button @click="changeType">change</button>
	</div>
	<script type="text/javascript">
		Vue.component('child-one',{
			template:'<div v-once>child-one</div>'
		})
		Vue.component('child-two',{
			template:'<div v-once>child-two</div>'
		})	
		var vm=new Vue({
			el:'#root',
			data:{
				type:'child-one'
			},
			methods:{
				changeType:function(){
					this.type=this.tpye=='child-one'?'child-two':'child-one'
				}
			}
		})
	</script>
</body>
</html>